﻿@model IEnumerable<Kairos.Models.Document>

@{
    ViewBag.Title = "Alarmes";
}

<h2>Documents expirés</h2>

@if (Model.Count() == 0)
{
    <p>
        Aucun document expiré
    </p>
}
else
{
    <table>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.Titre)
            </th>
            <th>
                @Html.DisplayName("Expiré le")
            </th>
            <th>
                @Html.DisplayName("Lien")
            </th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Titre)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.DateExpiration)
                </td>
                <td>
                    @Html.ActionLink("/Doc/Details/" + item.ID, "Details", new { id = item.ID })
                </td>
                <td>
                    @using (Html.BeginForm("Alarme", "Doc", new { id = item.ID }, FormMethod.Post, new
                {
                    onsubmit = @"return confirm('Le délai d\'expiration du document sera reporté.')"
                }))
                    {
                        @Html.AntiForgeryToken()
                        if (ViewBag.ShouldDisplayUI(Kairos.Roles.Administrator | Kairos.Roles.Worker))
                        {
                            <input type="submit" value="Différer" class="actionlink" />
                        }
                    }
                </td>
            </tr>
        }

    </table>
}
